package cn.alf.ssh.mlxt.service.impl;

import java.util.List;

import javax.annotation.Resource;

import cn.alf.ssh.mlxt.dao.UserDao;
import cn.alf.ssh.mlxt.domain.User;
import cn.alf.ssh.mlxt.service.LoginService;

public class LoginServiceImpl implements LoginService {
    @Resource UserDao userDao ;
	public UserDao getUserDao() {
		return userDao;
	}
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}
	@Override
	public String login(String name, String password) {
		List<User> userList = this.userDao.getUserByName(name);
		if(userList.size()==1){
			User user = userList.get(0);
			if(user.getPassword().equals(password)){
				return "success";
			}else{
				return "password";
			}
		} else{
			return "error";
		}
	}
}
